namespace WOODIFramework.UI.Controllers
{
	using System;
    using WOODIFramework.Model.Helpers;
	using Castle.MonoRail.Framework;

    [Layout("default"), Rescue("generalerror"), Helper(typeof(DDDPageHelper))]
	public class HomeController : SmartDispatcherController
	{
		public void Index()
		{
            PropertyBag["Categories"] = Model.Category.FindAll();
            PropertyBag["Blogs"] = Model.Blog.FindAll();
		}

        public void ViewBlog(int BlogId)
        {
            PropertyBag["Categories"] = Model.Category.FindAll();
            PropertyBag["Blog"] = Model.Blog.FindByID(BlogId);
        }

        public void ViewBlogsByCategory(int CategoryId)
        {
            PropertyBag["Categories"] = Model.Category.FindAll();
            PropertyBag["Blogs"] = Model.Blog.FindBlogsByCategory(CategoryId);
        }
	}
}
